package com.zkingsoft.actions.feedback;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.zkingsoft.actions.common.BaseController;
import com.zkingsoft.model.Project;
import com.zkingsoft.plugin.util.WebUtil;
import com.zkingsoft.services.ClientService;
import com.zkingsoft.services.ProjectService;
import com.zkingsoft.syslog.SysLogService;

@RequestMapping(value = "/feedback/client")
@Controller
public class ClientLoginController extends BaseController {

	@Resource
	private SysLogService logService;
	@Resource
	private ClientService clientService;// 客户Service
	@Resource
	private ProjectService projectService;//项目service

	@RequestMapping(value = "/redirect/{page1}")
	public String redirect(@PathVariable("page1") String page1) {
		//把客户的项目信息返回
		Project project = new Project();
		project.setCustId(getClientMe().getId());
		List<Project> projList = projectService.findByModel(project);
		if(projList!=null && projList.size()>0){
			WebUtil.getRequest().setAttribute("projList", projList);
		}		
		return "feedback/" + page1;
	}

	@RequestMapping(value = "/redirect/{page1}/{page2}")
	public String redirect(@PathVariable("page1") String page1, @PathVariable("page2") String page2) {
		return "feedback/" + page1 + "/" + page2;
	}

	@RequestMapping(value = "/loginOut")
	public String loginOut(HttpSession session, HttpServletResponse response) throws Exception {
		session.invalidate();
		return "redirect:/common/redirect/client_login";
	}
	
	
	
	
	
}
